<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*" %>
<%@ page import="au.com.somethingwritten.model.*" %>
	<%
           if (request.getParameter("fromMasterPage") == null)
           {
                %>
                  <jsp:forward page="masterPage.jsp">
                    <jsp:param name="embeddedPageName" value 
                     ="bookPage.jsp"/>
                     <jsp:param name="submitPageName" value 
                     ="bookPage.jsp"/>
                  </jsp:forward>
                <%
           }
      %>
		<h2>Book Details</h2>
		<div class="book_details">
		
		<%
  			Book curBook = (Book) request.getAttribute("resultBook");
   			
			out.print("<div class=\"book_details\"> \n");
   			//display image and set alt text
   			out.print("<img src=\"" + curBook.getImageFile() + "\" alt=\"" + curBook.getTitle() + " Cover\" /> \n" );
   			out.print("<div class=\"book_detail\"> \n");
   			//display title
   			out.print("<h3>" + curBook.getTitle() + "</h3><br />");
   			//display author
   			out.print("by: " + curBook.getAuthor() + "<br />");
   			//display price
   			out.print("$" + String.format("%1$,.2f", curBook.getPrice()) + "<br />");
   			//display ISBN
   			out.print("ISBN: " + curBook.getISBN() + "<br /><br />");
   			//display buy button
   			out.print("<form name=\"add_to_cart\" method=\"post\" action=\"addToCart?book_id=" + curBook.getId().toString() + "&quantity=1\">");
				out.print("<button class=\"addToCart\" type=\"submit\" name=\"addToCart\">Add to cart</button><br />");
			out.print("</form>");
   			//display author
   			out.print("<h4>Description:</h4>" + curBook.getDescription() + "<br />");
   			out.print("</div> \n");
   			out.print("<div class=\"float_clear\"></div> \n");
   			out.print("</div> \n");
		%>
		</div>